package personnel.department.pages.widgets.combo;

import java.lang.reflect.Field;

import org.eclipse.swt.widgets.Composite;

public class ComboWidgetFactory {
	
	private static final String POST = "post";
	private static final String TYPE = "type";
	private static final String BASE_WORK = "baseWork";
	private static final String INT_WORK = "internalWork";
	private static final String EXT_WORK = "externalWork";

	public static AbstractComboWidget getComboWidget(Composite parent, String title, Field field) {
		String fieldName = field.getName();
		switch (fieldName) {
		case POST:
			return new PostComboWidget(parent, title, field);
		case TYPE:
			return new TypeComboWidget(parent, title, field);
		case BASE_WORK:
			return new PostComboWidget(parent, title, field);
		case INT_WORK:
			return new PostComboWidget(parent, title, field);
		case EXT_WORK:
			return new PostComboWidget(parent, title, field);
		default:
			throw new IllegalArgumentException("Unknown combo type: " + fieldName);
		}
	}
	
}
